<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl">
    <link rel="stylesheet" href="/js/plugins/treeview/bootstrap-treeview.min.css" type="text/css">
    <script type="text/javascript" src="/js/plugins/treeview/bootstrap-treeview.min.js"></script>
    <script>
        $(function () {
            $('.inputBtn').click(function () {
                var obj = $(this).data('json');
                $('#inputForm input').val('');
                if (obj){
                    $("#inputForm input[name='id']").val(obj.id);
                    $("#inputForm select[name='state']").val(obj.state);
                }
                $('#inputModal').modal('show');
            });
            $('.inputSubmit').click(function () {
                $('#inputForm').submit();
            });
            var imgUrls = $(".imgUrls");
            for(var k=0;k<imgUrls.length;k++){
                var temp = $(imgUrls[k]);
                var imgs = temp.html().split(";");
                temp.empty();
                for(var i=0;i<imgs.length;i++){
                    temp.append("<img src='"+imgs[i]+"' width='50px' style='margin-right:5px'/>");
                }
            }

        })
    </script>
    <style type="text/css">
        img{
            cursor: pointer;
            transition: all 0.6s;
        }
        img:hover{
            transform: scale(5.5);
            z-index: 999;
            POSITION: relative;
        }

    </style>

</head>
<body>
<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
            <#assign currentMenu = "strategyComment" />
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">攻略评论管理</h1>
                </div>
            </div>
            <form class="form-inline" id="searchForm" action="/strategyComment/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
            </form>
            <div class="row">
                <table class="table table-striped table-hover">
                    <thead>
                    <tr>
                        <th>评论者</th>
                        <th>评论时间</th>
                        <th>图片</th>
                        <th>星星</th>
                        <th>攻略</th>
                        <th>状态</th>
                        <th width="28%">内容</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                        <#list pageInfo.list as entitry>
                        <tr>
                            <td>${entitry.user.nickName}</td>
                            <td>${entitry.createTime?string("yyyy-MM-dd HH:mm:ss")}</td>
                            <td class="imgUrls">${entitry.imgUrls}</td>
                            <td>${entitry.starNum}</td>
                            <td>${entitry.strategy.title}</td>
                            <td><#if entitry.state == 0>
                                正常
                            <#elseif entitry.state == 1>
                                推荐
                            <#elseif entitry.state == -1>
                                禁用
                            </#if></td>
                            <td>${entitry.content}</td>
                            <td>
                                <a data-json='${entitry.json}'
                                        class="btn btn-info btn-xs inputBtn" href="javascript:">
                                    <span class="glyphicon glyphicon-pencil"></span>修改状态
                                </a>
                            </td>
                        </tr>
                        </#list>
                    </tbody>
                </table>
                <#include "../common/page.ftl">
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/strategyComment/updateState.do" method="post"
                      id="inputForm" enctype="multipart/form-data">
                    <input type="hidden" name="id">
                    <div class="form-group">
                        <label class="col-lg-4 control-label">推荐类型：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="state">
                                <option value="-1">禁用</option>
                                <option value="0">正常</option>
                                <option value="1">推荐</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary inputSubmit">保存</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>